﻿
@{
    ViewBag.Title = "OrderView";
    Layout = "~/Views/ByJuYe/BuJuYe.cshtml";
}



<script src="e:\暂存空间\专业课\我的项目\第三学期\项目\b2c\shixulong.model\scripts\jquery-3.5.1.js"></script>



<!-- section -->
<div class="section">
    <!-- container -->
    <div class="container">
        <!-- row -->
        <div class="row">
            <form id="checkout-form" onsubmit="return false" class="clearfix">

                <div class="col-md-12">
                    <div class="order-summary clearfix">
                        <div class="section-title">
                            <h3 class="title">订单展示</h3>
                        </div>

                        <table class="shopping-cart-table table">

                            <thead>
                                <tr>
                                    <th></th>
                                    <th>商品名称</th>
                                    <th class="">商品图片</th>
                                    <th class="text-center">单价</th>
                                    <th class="text-center">数量</th>
                                    <th class="text-center">实付款</th>
                                    @*<th class="text-right">交易操作</th>*@
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (var item in Model)
                                {
                                    <tr>
                                        <td><input type="checkbox" class="carts" name="Carts" id="@item.Id" /></td>
                                        <td class="details">
                                            <a href="#">@item.ShopName</a>
                                            <ul>
                                                <li><span>Size: XL</span></li>
                                                <li><span>Color: Camelot</span></li>
                                            </ul>
                                        </td>
                                        <td class="thumb"><img src="~/FrontDesk/img/thumb-product01.jpg" alt=""></td>

                                        <td class="price text-center"><strong>$32.50</strong><br><del class="font-weak"><small>$40.00</small></del></td>
                                        <td class="text-center">1</td>
                                        <td class="text-center">$@item.Price</td>
                                        @*<td class="text-right"><button class="CheckDetail1" name="@item.Id">查看详情 </button></td>*@
                                    </tr>
                                }

                            </tbody>
                            <tfoot>
                                <tr>
                                    <th class="empty" colspan="3"></th>
                                    <th>SUBTOTAL</th>
                                    <th colspan="2" class="sub-total">$97.50</th>
                                </tr>
                                <tr>
                                    <th class="empty" colspan="3"></th>
                                    <th>SHIPING</th>
                                    <td colspan="2">Free Shipping</td>
                                </tr>
                                <tr>
                                    <th class="empty" colspan="3"></th>
                                    <th>TOTAL</th>
                                    <th colspan="2" class="total">$97.50</th>
                                </tr>
                            </tfoot>
                        </table>
                        <div class="pull-right">
                            <button class="primary-btn" id="subBtn">提交按钮</button>
                            <button class="primary-btn" id="ClearCart1">清空购物车</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <!-- /row -->
    </div>
    <!-- /container -->
</div>
<!-- /section -->

<script src="~/lib/layui/layui.js"></script>
<script>
    layui.use(['layer'], function () {
        var $ = layui.$;
        var layer = layui.layer;
        var carts = "";
        $(".CheckDetail").click(function () {
            var con = this.name;
            location.href = "/UserCenter/OrderDetailView?id=" + con;
        });
        $(".carts").click(function () {
            carts += this.id + ",";
        });
        $("#subBtn").click(function () {
            $.ajax({
                url: "/Cart/PlaceOrder",
                type: "post",
                data: { ids: carts },
                success: function (re) {

                }
            });
            return false;
        });
        $("#ClearCart").click(function (re) {
            layer.confirm('小主您确定要清空购物车吗？', function (index) {
                $.ajax({
                    url: "/Cart/ClearCart",
                    type: "Post",
                    data: "",
                    success: function (re) {
                        if (re.success > 0) {
                            layer.msg(re.msg);
                            layer.close(index);
                        }
                        else {
                            layer.msg(re.msg);
                            layer.close(index);
                        }
                    }
                });
            });
            return false;
        });
        $(".main-btn").click(function () {
            console.log(1);
            var con = $("#delBtn").attr("name");
            $.ajax({
                url: "/Cart/DelCartShop",
                type: "post",
                data: { id: con },
                success: function (re) {

                }
            });
        });
    });
</script>
